home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / flight-of-the-museum.swf / scripts / ui / SplashScreen.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  2.0 KB  |  88 lines

  1. package ui
  2. {
  3.    import flash.display.MovieClip;
  4.    
  5.    [Embed(source="/_assets/assets.swf", symbol="ui.SplashScreen")]
  6.    public class SplashScreen extends MovieClip
  7.    {
  8.        
  9.       
  10.       public var _bg:MovieClip;
  11.       
  12.       private var _frameSpeed:Number = 0;
  13.       
  14.       public var _btn_playGame:MovieClip;
  15.       
  16.       public var _release_date:MovieClip;
  17.       
  18.       public var _ben:MovieClip;
  19.       
  20.       private var _retracted:Boolean = false;
  21.       
  22.       public function SplashScreen()
  23.       {
  24.          _frameSpeed = 0;
  25.          _retracted = false;
  26.          super();
  27.          trace("SplashScreen con");
  28.          addEventListener("enterFrame",onSplashScreenEnterFrame);
  29.       }
  30.       
  31.       public function retract() : *
  32.       {
  33.          _frameSpeed = 1;
  34.       }
  35.       
  36.       public function showElements() : *
  37.       {
  38.          _frameSpeed = -1;
  39.       }
  40.       
  41.       private function onSplashScreenEnterFrame(event:*) : *
  42.       {
  43.          stop();
  44.          this.gotoAndStop(this.currentFrame + _frameSpeed);
  45.          if(this.currentFrame >= this.totalFrames - 1)
  46.          {
  47.             _frameSpeed = 0;
  48.             _retracted = true;
  49.          }
  50.          else
  51.          {
  52.             _retracted = false;
  53.          }
  54.          if(this.currentFrame <= 1)
  55.          {
  56.             _frameSpeed = 0;
  57.          }
  58.          if(_frameSpeed < 0 || this.currentFrame <= 1)
  59.          {
  60.             _bg.alpha += (1 - _bg.alpha) * 0.25;
  61.             _bg.visible = true;
  62.          }
  63.          if(_frameSpeed > 0)
  64.          {
  65.             _bg.alpha += (0 - _bg.alpha) * 0.25;
  66.             if(_bg.alpha < 0.02)
  67.             {
  68.                _bg.visible = false;
  69.             }
  70.          }
  71.       }
  72.       
  73.       public function get Retracted() : Boolean
  74.       {
  75.          return _retracted;
  76.       }
  77.       
  78.       public function retractInstant() : *
  79.       {
  80.          this.gotoAndStop(this.totalFrames - 1);
  81.          _frameSpeed = 0;
  82.          _retracted = true;
  83.          _bg.alpha = 0;
  84.          _bg.visible = false;
  85.       }
  86.    }
  87. }
  88.